From 3de33368111c6a59e1f317e0684f21fa9fc75daf Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 4 Feb 2024 08:44:41 -0800
Subject: refactor(badges): use size variables

---
 src/routes/user/[user]/badges/+page.svelte | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/routes/user/[user]/badges/+page.svelte')

diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index 365fdb9b..9b7b8f07 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -284,11 +284,14 @@
 	};
 
 	const thumbnail = (url: string | undefined) => {
+		const width = 144;
+		const height = 200;
+
 		if (url && url.includes('catbox.moe') && !url.includes('gif'))
 			return url.replace('catbox.moe/', 'catbox.moe/thumbs/t_');
 
 		if (url && url.includes('imgur') && !url.includes('gif'))
-			return url.replace(/(\.\w+)$/, '_d.webp?maxwidth=144&shape=thumb&fidelity=high');
+			return url.replace(/(\.\w+)$/, `_d.webp?maxwidth=${width}&shape=thumb&fidelity=high`);
 
 		if (url && url.includes('discordapp')) {
 			const match = url.match(/attachments\/(\d+)\/(\d+)\/(.+)/);
@@ -296,7 +299,7 @@
 			if (match) {
 				const [_, server, id, file] = match;
 
-				return `https://media.discordapp.net/attachments/${server}/${id}/${file}?width=144&height=200`;
+				return `https://media.discordapp.net/attachments/${server}/${id}/${file}?width=${width}&height=${height}`;
 			}
 		}
 
-- 
cgit v1.2.3

